from django.urls import path

from .views import (
    TestUserView, JwtTestView, LoginView, RegisterView,
    UserListView, UserDetailView, UserUpdateView, UserPasswordUpdateView, 
    UserStatusUpdateView, UserDeleteView, UserProfileView,
    BookListView, BookDetailView, BookCreateView, BookUpdateView, BookDeleteView,
    BorrowBookView, ReturnBookView, BorrowRecordListView,
    RoleListView, RoleCreateView, UserRoleAssignView,
    BookHotRankingView, CategoryHotRankingView, AuthorHotRankingView
)

urlpatterns = [
    # 用户相关
    path('testUser', TestUserView.as_view(), name='testUser'),
    path('jwttest', JwtTestView.as_view(), name='testUser'),
    path('login', LoginView.as_view(), name='login'),
    path('register', RegisterView.as_view(), name='register'),
    
    # 用户管理
    path('users', UserListView.as_view(), name='user_list'),
    path('users/<int:user_id>', UserDetailView.as_view(), name='user_detail'),
    path('users/<int:user_id>/update', UserUpdateView.as_view(), name='user_update'),
    path('users/<int:user_id>/password', UserPasswordUpdateView.as_view(), name='user_password_update'),
    path('users/<int:user_id>/status', UserStatusUpdateView.as_view(), name='user_status_update'),
    path('users/<int:user_id>/delete', UserDeleteView.as_view(), name='user_delete'),
    path('profile', UserProfileView.as_view(), name='user_profile'),
    
    # 图书管理
    path('books', BookListView.as_view(), name='book_list'),
    path('books/<int:book_id>', BookDetailView.as_view(), name='book_detail'),
    path('books/create', BookCreateView.as_view(), name='book_create'),
    path('books/<int:book_id>/update', BookUpdateView.as_view(), name='book_update'),
    path('books/<int:book_id>/delete', BookDeleteView.as_view(), name='book_delete'),
    
    # 热榜管理
    path('hot-ranking/books', BookHotRankingView.as_view(), name='book_hot_ranking'),
    path('hot-ranking/categories', CategoryHotRankingView.as_view(), name='category_hot_ranking'),
    path('hot-ranking/authors', AuthorHotRankingView.as_view(), name='author_hot_ranking'),
    
    # 借阅管理
    path('borrow', BorrowBookView.as_view(), name='borrow_book'),
    path('return', ReturnBookView.as_view(), name='return_book'),
    path('borrow-records', BorrowRecordListView.as_view(), name='borrow_records'),
    
    # 角色管理
    path('roles', RoleListView.as_view(), name='role_list'),
    path('roles/create', RoleCreateView.as_view(), name='role_create'),
    path('user-role/assign', UserRoleAssignView.as_view(), name='user_role_assign'),
]
